﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class NPC_XiaoHong : MonoBehaviour
{
    private GameObject _player;
    private PlayerMovement _playerMovement;

    private void OnEnable()
    {
        if (_player == null)
        {
            _player = GameObject.FindWithTag("Player");
            _playerMovement = _player.GetComponent<PlayerMovement>();
        }

        transform.position = _player.transform.position;
    }

    private void OnDisable()
    {
        _player.transform.position = transform.position;

        _playerMovement.SetDirection(transform.localScale.x >= 0f);
    }
}